<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Nest</title>
</head>

<body>

  <button>Test</button>
  <button>Test Post</button>

  <script>

    document.querySelector('button').addEventListener('click', () => {
      window.fetch('http://localhost:3000/app/param?id=100').then(res => res.text()).then(resp => {
        console.log('🌈 —— data-resp --->', resp)
      })
    })

    document.querySelectorAll('button')[1].addEventListener('click', () => {
      window.fetch('http://localhost:3000/app/param.p', {
        method: 'POST',
        headers: {
          "Content-Type": "application/json;charset=utf-8"
        },
        body: JSON.stringify({
          name: 'jack',
          age: 19,
          gander: 'man'
        })
      }).then(res => res.json()).then(resp => {
        console.log('🌈 —— data-resp --->', resp)
      })
    })
  </script>

</body>

</html>